﻿@model dynamic

@{
    ViewBag.Title = "接口测试"; 
}

 
    <div class="am-panel am-panel-default">
        <div class="am-panel-bd">
            <form class="am-form" method="POST">

                <div class="am-form-group">
                    <label>json=</label>
                    <textarea id="json">{"check":"91d8666dd864d7eb26b8ff201b4b9c15","data":"0","fn":"0000","suid":"2"}</textarea>
                </div>
                <div class="am-form-group">
                    <label>结果:</label>
                    <div>
                        <textarea id="data" disabled="disabled"></textarea>
                    </div>

                </div>

                <p>
                    <button onclick="start()" type="button" class=" am-btn am-btn-default">点击测试</button>
                </p>
                <p id="suc"></p>
            </form>

        </div>
    </div>
 

@*<div class="row-fluid">
        <div class="panel panel-default">
            <div class="panel-heading">不加密测试</div>
            <div class="panel-body">
                <form id="formdatatest" class="form-horizontal" method="POST">
                    <div class="form-group">
                        <label class="control-label col-md-2">Fn:</label>
                        <div class="col-md-6">
                            <input name="fn" type="text" value="0000" class="form-control" />
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">发送data:</label>
                        <div class="col-md-6">
                            <textarea name="data" class="form-control"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="control-label col-md-2">返回data:</label>
                        <div class="col-md-6">
                            <textarea id="data2" class="form-control" disabled="disabled"></textarea>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-md-6">
                            <button onclick="start2()" type="button" class=" btn btn-primary  btn-block">点击测试</button>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-offset-2 col-md-6">
                            <p id="suc2"></p>

                        </div>
                    </div>

                </form>
            </div>
        </div>
    </div>*@
@section scripts
{
    <script>
        function start() {
            $.doPost("@Url.Action("Post","Api")", 'json=' + $("#json").val(), function (d) {

                if (d.status) {
                    $("#suc").text("验证成功") ;
                } else {
                    $("#suc").text("失败信息:" + d.msg) ;
                }
                $("#data").val(JSON.stringify(d));
            });
        }

        function start2() {
            $.doPost("@Url.Action("Testdata","Service")", $("#formdatatest").serialize(), function (d) {

                if (d.status) {
                    $("#suc2").text("成功").attr("class", "text-success");;
                } else {
                    $("#suc2").text("失败信息:" + d.msg).attr("class", "text-danger");
                }
                $("#data2").val(JSON.stringify(d.data));
            });
        }
    </script>
}
